UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UvGEYsQVrYq862k0ijaTAgWs8dDLnNOUQXH2l5QuO4k=' 
WHERE 
  key_id = 'ca0d83a979585467d0291bfb9d99dabd8309045217116b98886c84740be18107' 
  AND (
    token = 'UvGEYsQVrYq862k0ijaTAgWs8dDLnNOUQXH2l5QuO4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018