UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A91enNwqa6QJeQbrkd+qtq+EKXHzrw3K4KcUhKSIU/c=' 
WHERE 
  key_id = '4ee2b2cfb4c435a355f2f68c053203eb2955dac11154398a479a969b82a1fa2e' 
  AND (
    token = 'A91enNwqa6QJeQbrkd+qtq+EKXHzrw3K4KcUhKSIU/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046