UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3N8BeoJpGuyFfNlYlsY39p406JXdEk89yPI//u92CLk=' 
WHERE 
  key_id = '3d05bd6b3daaba3833ea4cc729972360732f7df49984e819d70b87c25021d575' 
  AND (
    token = '3N8BeoJpGuyFfNlYlsY39p406JXdEk89yPI//u92CLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030