UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UpO7FN89liC1E17ru76cDeosFA4qJ8FcCX8wdUTa3bc=' 
WHERE 
  key_id = '1426a620dc737413c9c8600c4d3a289023a4c2264fcde008403be4b6d9df5d2d' 
  AND (
    token = 'UpO7FN89liC1E17ru76cDeosFA4qJ8FcCX8wdUTa3bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069