UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HpkPppsKymEqro7/1xmW08wWW9K9EjhcVxEV1Tln4TM=' 
WHERE 
  key_id = '5efce6be604a24543995acacfe03deb66d3f7596a5c465fd123cde8a9d030490' 
  AND (
    token = 'HpkPppsKymEqro7/1xmW08wWW9K9EjhcVxEV1Tln4TM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048