UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UY49Cb1aQFB4hj0+iHVYOmEZ2hZs9oJ0BFkiLkspqXs=' 
WHERE 
  key_id = '47c2b03abd484e95dbf2a79648a8b9f088543f1136544caf24f02530cdc031d4' 
  AND (
    token = 'UY49Cb1aQFB4hj0+iHVYOmEZ2hZs9oJ0BFkiLkspqXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025