UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uxae1SCZp7iJLcwIYma6CiIf53gdSoW+jh1uhyjAOlE=' 
WHERE 
  key_id = 'bc6324003cf6570d32393cf6fda2fe3317f7932526114ba8c3d9f083e2e4ffea' 
  AND (
    token = 'Uxae1SCZp7iJLcwIYma6CiIf53gdSoW+jh1uhyjAOlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038