UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HlWtlbVRLwMeEFSt0WPSHfJuP2i3uTy3TbcntQDhQWY=' 
WHERE 
  key_id = '403f2eebc734a61a75f1da3d8206c86b7f24758c1b6b4e08afda4da173f9ad99' 
  AND (
    token = 'HlWtlbVRLwMeEFSt0WPSHfJuP2i3uTy3TbcntQDhQWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020