UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jpUu2RRxv5VefqrDWCfDmtE0kHIPgyiDu9pRgph5yuU=' 
WHERE 
  key_id = '733e6a32918d982519e2c5f5d2491be7c1a9809b8fc6ce8b729fedefd4885aa9' 
  AND (
    token = 'jpUu2RRxv5VefqrDWCfDmtE0kHIPgyiDu9pRgph5yuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032