UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZFr6icla83rzqZQ0UYHPcLst4Jv9mT5LQdy7apNQ+uE=' 
WHERE 
  key_id = '31cf74ec82ef3247c4f75de3152904a549f755b17468fac518e38f48f5a4760b' 
  AND (
    token = 'ZFr6icla83rzqZQ0UYHPcLst4Jv9mT5LQdy7apNQ+uE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036