UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2bMHkBsLsiAqi9ozR6iU1MLhq1YlY6sh/j3nSpSyrr4=' 
WHERE 
  key_id = 'f4d625c8014eaa69b2bb2ad07b939a1a6edd1325a5d42c75a2d4f8f01bcc6fb1' 
  AND (
    token = '2bMHkBsLsiAqi9ozR6iU1MLhq1YlY6sh/j3nSpSyrr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032