UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XExwR8DoisR4GsGaFborDWYg+dkr2bicw5zdkv4Scx8=' 
WHERE 
  key_id = 'abbd114b4611545fceff5139fc40a960a0b308ca0471baf562bc89c4da273aa4' 
  AND (
    token = 'XExwR8DoisR4GsGaFborDWYg+dkr2bicw5zdkv4Scx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038