UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfr05AzhO41GvL8oRfA8OFeRnPomnfMAJ97SDfWTzog=' 
WHERE 
  key_id = '65dbee0c7ebc08e24bdecd9b522acb964b7afc26e4ce64462023443f85f92eb6' 
  AND (
    token = 'vfr05AzhO41GvL8oRfA8OFeRnPomnfMAJ97SDfWTzog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048