UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+mYdGWpI2MW0tjnWf51Jw4l1/uA5EzwMuA+2kFP7+s=' 
WHERE 
  key_id = '125947aa5d607541e528f83b4d94c6f34ac4bb8ac102e986f941fc3302f9770d' 
  AND (
    token = 'f+mYdGWpI2MW0tjnWf51Jw4l1/uA5EzwMuA+2kFP7+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027