UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aaui0XH/dckSG5nXb06JM6nXxEl2jXkuerrbdehXOGE=' 
WHERE 
  key_id = '80a93f1e177146685ba4616a0be699c7d2365ec7e48a0ad4989f49b4008e29ca' 
  AND (
    token = 'aaui0XH/dckSG5nXb06JM6nXxEl2jXkuerrbdehXOGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043