UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLQuMDoDP2SYCIxiruk7D541zdxeIU1M+b+GKbb8M30=' 
WHERE 
  key_id = '39eed7f2400c04a4a295ba9cef4f6089064e3a98ec212106762747881878c253' 
  AND (
    token = 'HLQuMDoDP2SYCIxiruk7D541zdxeIU1M+b+GKbb8M30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00218