UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'opD+4UD1fLaRyvUAEOz2R+SyKHyGtnDJ8ZRnvL3dTuU=' 
WHERE 
  key_id = 'bbbb196c42c1ad321bbeffb8bd28b1a259b83053f190b908c99914e7cc1ec09f' 
  AND (
    token = 'opD+4UD1fLaRyvUAEOz2R+SyKHyGtnDJ8ZRnvL3dTuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044