UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OzcChzaUFA2BUZoRM+tWeyXRvOLnv/XjO6LZCbGTsbU=' 
WHERE 
  key_id = '3bc36dafab433529b1f5821352b2db45adb51914a8fdbb8bcd76f7a653757850' 
  AND (
    token = 'OzcChzaUFA2BUZoRM+tWeyXRvOLnv/XjO6LZCbGTsbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032