UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nklq34Tcf992jyaWjs4hLFxMnPVG6j1AAp8kQWaXCVU=' 
WHERE 
  key_id = '2da65d51539c5be57c00eb3097649de704ab7bfacb9b5d55600619fac1014783' 
  AND (
    token = 'nklq34Tcf992jyaWjs4hLFxMnPVG6j1AAp8kQWaXCVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027