UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mL/myBO4/LZZ5ckXiUTaKMCTrfNn0NJkxnf+2sa795M=' 
WHERE 
  key_id = 'ac8b6fcee668f413e292b4359a1a7b88c73b858814e1a8306cb835e955d047d6' 
  AND (
    token = 'mL/myBO4/LZZ5ckXiUTaKMCTrfNn0NJkxnf+2sa795M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038