UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+nUFmGgOyt61qk4xOdi31PDEDwPn5JXskje3Qr3LBDg=' 
WHERE 
  key_id = '22d7cc0e567a1fb96013aa45e620eaf55fa2ea42769fb27d2a379761319e818e' 
  AND (
    token = '+nUFmGgOyt61qk4xOdi31PDEDwPn5JXskje3Qr3LBDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048