UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IVsdH5xxNPw0UIBIw3i6KP6YOwVFl5TTAspuZV6XZNs=' 
WHERE 
  key_id = '2d32a33224ee21d97a5d14939e96b83a85671230f071b5b6454e8cb298701fb7' 
  AND (
    token = 'IVsdH5xxNPw0UIBIw3i6KP6YOwVFl5TTAspuZV6XZNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017