UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FGUqM9KC3/doU1TZHnY/DJ79YDwgEi5xQ+WyPW6feOM=' 
WHERE 
  key_id = '654a0b21c4845597cf2fd03138d64fea12cf3aa74744e3d1048af649528a5360' 
  AND (
    token = 'FGUqM9KC3/doU1TZHnY/DJ79YDwgEi5xQ+WyPW6feOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030