UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mtq9SOpyLV2UKVyzBSODlH46rWiriE/MEOydeu+laKk=' 
WHERE 
  key_id = 'f4701fbaa2e261de0797ca2969dd407e5f29c2228b72d6587c03d6c908e76676' 
  AND (
    token = 'Mtq9SOpyLV2UKVyzBSODlH46rWiriE/MEOydeu+laKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074