UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BUP5bBzsHnjum9yqcfTH5HspIjuSayiAMURkOP5cmmA=' 
WHERE 
  key_id = 'cacbf13c5307fd39beeca04c93b685ec1f4cabc3c4609215cdae60239163b35c' 
  AND (
    token = 'BUP5bBzsHnjum9yqcfTH5HspIjuSayiAMURkOP5cmmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023