UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZUquTxcOCBmz8iZqqnwLfnF3tHXlrxfSLE1nFxrIpPU=' 
WHERE 
  key_id = '1832fe93950a9d132216c11ed24f58df4a7999d5dd089988046b9860576917ab' 
  AND (
    token = 'ZUquTxcOCBmz8iZqqnwLfnF3tHXlrxfSLE1nFxrIpPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042