UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4CovWgfWuuymorRv4zH0EoWEu8CcKMFv1EPxXieh5I=' 
WHERE 
  key_id = '51cc51703eb8d248a4a49852a196dec56086f359937b1e4573befb2e84a0966b' 
  AND (
    token = 'v4CovWgfWuuymorRv4zH0EoWEu8CcKMFv1EPxXieh5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045