UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mI8bVp9rZL6kAxlnTLFS6lgOFNvKkoSPHv/MatGrB54=' 
WHERE 
  key_id = '683ad647ec613858d9b92a6d301b6b589b9ee977657f26ece9950da1cb44d879' 
  AND (
    token = 'mI8bVp9rZL6kAxlnTLFS6lgOFNvKkoSPHv/MatGrB54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032