UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wjz4G9Ihxeo2PysRoc6VjE+3leo07ADsr72VYjgbQ18=' 
WHERE 
  key_id = 'e4be959cf388379efaec7f5533549e9238d7e93b96fb89d9642d8a7e2696c52f' 
  AND (
    token = 'wjz4G9Ihxeo2PysRoc6VjE+3leo07ADsr72VYjgbQ18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049