UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T/v3hi7urZD05ACrA+tK1EuCQU1wRkHttFekpERHrls=' 
WHERE 
  key_id = '9380018b60c095b0ead945d4ddc04d0ddc297068b3053f59ca509099d14e6d75' 
  AND (
    token = 'T/v3hi7urZD05ACrA+tK1EuCQU1wRkHttFekpERHrls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044