UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJ27lXeRn9XN6pAFdFfeHEbQpM258r3bsLE6jo+EXj0=' 
WHERE 
  key_id = '3773f6ee161427def3def59025e379167e673f29d684bfd354b0c55436720859' 
  AND (
    token = 'BJ27lXeRn9XN6pAFdFfeHEbQpM258r3bsLE6jo+EXj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032