UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MNulrOQ2aLZYRsdXlA7gMWHhbLx5+YE4ZeGSanxP3jk=' 
WHERE 
  key_id = '20f2d836b54b15b9099b51f09f0aec268c6bbbf06e12d4fa334c549f52cd6a9a' 
  AND (
    token = 'MNulrOQ2aLZYRsdXlA7gMWHhbLx5+YE4ZeGSanxP3jk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045